<?php
class AdvModule
{
	public function show()
	{
		global $_FANWE;
		$adv_id = intval($_FANWE['request']['id']);
    	$adv = DB::fetchFirst('SELECT url,name,auction_id FROM '.DB::table('adv').' WHERE id = '.$adv_id.' AND status = 1 AND is_show = 1');
		
		if($adv)
		{
			if($adv['auction_id'] > 0)
				S('auction')->insertAuctionClick($adv_id,$adv,'adv');
			
	    	if(!empty($adv['url']))
	    	{
				DB::query('UPDATE '.DB::table('adv').' SET click_count = click_count + 1 WHERE id = '.$adv_id);
				fHeader('location:'.$adv['url']);
	    	}
	    	else
	    	{
	    		fHeader('location:./');
	    	}
	    }
	    else
	    {
	    	fHeader('location:./');
	    }
	}
}
?>